import {get} from "@utils/http"

// pages/mine/mine.ts
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isauthenticate:false,
    user:{},
    msg:0,
    minelist:["我的活动","消息通知","我的店铺","评论动态","简历管理","收藏夹","草稿箱","反馈问题","关于我们","用户协议"],
    icons:["activity","notice","shop","dynamic","resume","collection","paper","question","about","user"],
  },
  fitin:function(){
    wx.navigateTo({
      url:"/pages/user/fitin/fitin"
    })
  },
  mineindex:function(e){
    var index=e.currentTarget.dataset.index
    if(index==0){
      wx.navigateTo({
        url:"/pages/activity/activity-mine/activity-mine"
      })
    }else{
      if(index==1){
        wx.navigateTo({
          url:"../news/news"
        })
      }else{
        if(index==2){
          wx.navigateTo({
            url:"/pages/shop/shop-mine/shop-mine"
          })
        }else{
          if(index==3){
            wx.navigateTo({
              url:"/pages/dynamic/dynamic-mine/dynamic-mine"
            })
          }else{
            if(index==4){
              wx.navigateTo({
                url:"../resume/resume"
              })
            }
          }
        }
      }
    }
  },
  changemine(){
    wx.navigateTo({
      url:"/pages/user/user-update/user-update"
    })
  },
  async init(){
    let user=wx.getStorageSync("userInfo")
    if(!user){
      await get("/plan")
      user=wx.getStorageSync("userInfo")
    }
    if(!user.nameFake){
      user.nameFake=`游客${user.openid.slice(0,6)}`
    }
    this.setData({
      isauthenticate:!!user.name,
      user:user
    })
  },
 

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  async onShow() {
    this.init()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})